package com.gtt.jr.action.admin;

import javax.annotation.Resource;

import com.gtt.jr.action.base.BaseModelAction;
import com.gtt.jr.action.model.ContainerAddModel;
import com.gtt.jr.app.ContainerRepository;
import com.gtt.jr.app.domain.ContainerVO;

/**
 * 集装箱修改
 * 
 * @author 高甜甜(gao12581@sina.com)
 * @date 2010-9-13
 * 
 */
public class ContainerEditAction extends BaseModelAction<ContainerAddModel> {

	private static final long serialVersionUID = -1700791607559336805L;

	@Resource
	private ContainerRepository containerRepository;
	
	@Override
	public String execute() throws Exception {
		ContainerVO vo = containerRepository.get(getModel().getId());
		setModel(vo);
		return SUCCESS;
	}

	private void setModel(ContainerVO vo) {
		getModel().setName(vo.getName());
		getModel().setDescription(vo.getDescription());
		getModel().setType(vo.getType());
	}
	
	@Override
	public String getBread() {
		return super.getBread() + ARROW + "集装箱管理" + ARROW + "集装箱信息编辑";
	}
}
